//
// Created by ta&to on 2022/9/14.
//
#include "tcpserver.h"

void inittask(thread_pool_t *tpt){
    Thread_Pool_Init(tpt);
    tpt->initthreads = 10;
    tpt->maxthreads = 100;
    tpt->minthreads = 5;
    Thread_Pool_Commit(tpt);
    Thread_Pool_Monitor(tpt);
}

void initlog(thread_pool_t *tpt,log_t *logt){
    log_init(logt);
    Thread_Task_Post(tpt, tcp_log_cycle, logt);
}

void _init_socket(log_t *logt, int listen_port, void* socket_func, void* tcp_func) {
    init_conn(logt, listen_port, -1, socket_func, tcp_func);
}

void initTcp(log_t *logt, int listen_port, void* func) {
    _init_tcp();
    _init_socket(logt, listen_port, _tcp_socket_callback, func);
}